{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**NOTE:** This notebook should be the first one to be run in the analysis pipeline, since it defines the outliers that will be discarded in all future analyses."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports\n",
    "\n",
    "Import all the modules and functionalities we need."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-09-10T01:45:36.113095Z",
     "iopub.status.busy": "2021-09-10T01:45:36.112097Z",
     "iopub.status.idle": "2021-09-10T01:45:37.274390Z",
     "shell.execute_reply": "2021-09-10T01:45:37.273387Z",
     "shell.execute_reply.started": "2021-09-10T01:45:36.113095Z"
    }
   },
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "# Import standard libraries.\n",
    "from collections import defaultdict\n",
    "import os\n",
    "\n",
    "# Import third party libraries.\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "# Import custom libraries/scripts.\n",
    "import annotations\n",
    "import helpers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Loading data\n",
    "\n",
    "Fetch all our relevant data for the current analysis."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-09-10T01:45:37.276387Z",
     "iopub.status.busy": "2021-09-10T01:45:37.275389Z",
     "iopub.status.idle": "2021-09-10T01:45:37.290473Z",
     "shell.execute_reply": "2021-09-10T01:45:37.289381Z",
     "shell.execute_reply.started": "2021-09-10T01:45:37.276387Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 1 ms\n"
     ]
    }
   ],
   "source": [
    "# Set working contants.\n",
    "EXPERIMENTS_PATH = r'E:\\Miguel\\PhD\\Results\\Competition\\DL\\Four-Arena Setup\\sensory_mutants\\processed'\n",
    "FPS = 60\n",
    "N_MINUTES = 60\n",
    "N_FRAMES = N_MINUTES * 60 * FPS"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-09-10T01:45:37.293380Z",
     "iopub.status.busy": "2021-09-10T01:45:37.292379Z",
     "iopub.status.idle": "2021-09-10T01:45:37.305371Z",
     "shell.execute_reply": "2021-09-10T01:45:37.304371Z",
     "shell.execute_reply.started": "2021-09-10T01:45:37.292379Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Paths to conditions:\n",
      " ['F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless', 'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL', 'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA', 'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1', 'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2']\n",
      "time: 998 µs\n"
     ]
    }
   ],
   "source": [
    "# Set the conditions to analyze.\n",
    "# \"Ir8a_Ir25a_ORCO_Gr63a\" condition is not included because there are very few (n=3) experiments with aggression, and many with zero aggression.\n",
    "# This would mean that with all the zeros weighing the mean down, some of the few actual values we have would be deemed as outliers.\n",
    "condition_order = ['DL', 'PoxN1', 'PoxN2', 'aristaless', 'NorpA']#, 'Ir8a_Ir25a_ORCO_Gr63a']\n",
    "conditions = [item.path for item in os.scandir(EXPERIMENTS_PATH) if item.name in condition_order]\n",
    "print('Paths to conditions:\\n', conditions)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-09-10T01:45:37.307371Z",
     "iopub.status.busy": "2021-09-10T01:45:37.307371Z",
     "iopub.status.idle": "2021-09-10T01:45:37.353344Z",
     "shell.execute_reply": "2021-09-10T01:45:37.352345Z",
     "shell.execute_reply.started": "2021-09-10T01:45:37.307371Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['video_2019-02-26T14_04_30_arena3', 'video_2018-10-30T14_27_48_arena4', 'video_2019-01-22T14_37_51_arena3', 'video_2018-11-08T15_53_03_arena1', 'video_2018-11-20T15_54_06_arena1', 'video_2019-01-10T15_20_27_arena4', 'video_2019-01-11T14_09_38_arena2']\n",
      "7\n",
      "time: 39 ms\n"
     ]
    }
   ],
   "source": [
    "# Create a list of all the experiments that we DO NOT want to analyze.\n",
    "intruders = []\n",
    "for condition_path in conditions:\n",
    "    condition = os.path.basename(condition_path)\n",
    "    for file in os.listdir(condition_path):\n",
    "        if 'quality_control' in file:\n",
    "\n",
    "            # Read the quality.csv file to check which experiments are usable for analysis.\n",
    "            quality_file = os.path.join(condition_path, file)\n",
    "            quality_df = pd.read_csv(quality_file, usecols=[0,1], index_col=0)\n",
    "            quality_df = quality_df[quality_df['is_usable'] == False].index.values\n",
    "\n",
    "            for value in quality_df:\n",
    "                intruders.append(value + '_slice1' if condition=='virgin_added' else value)\n",
    "\n",
    "print(intruders)             \n",
    "print(len(intruders))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-09-10T01:45:37.354343Z",
     "iopub.status.busy": "2021-09-10T01:45:37.354343Z",
     "iopub.status.idle": "2021-09-10T01:45:37.432373Z",
     "shell.execute_reply": "2021-09-10T01:45:37.431373Z",
     "shell.execute_reply.started": "2021-09-10T01:45:37.354343Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t\n",
      " aristaless\n",
      "video_2019-02-04T15_15_41_arena3\n",
      "video_2019-02-07T14_18_30_arena4\n",
      "video_2019-02-22T14_13_46_arena2\n",
      "video_2019-02-26T14_04_30_arena2\n",
      "\t\n",
      " DL\n",
      "video_2019-02-12T14_18_45_arena3\n",
      "\t\n",
      " NorpA\n",
      "video_2018-11-08T14_54_53_arena1\n",
      "video_2018-11-26T16_15_44_arena2\n",
      "\t\n",
      " PoxN1\n",
      "\t\n",
      " PoxN2\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'DL': ['F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-10-25T13_42_23_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-10-25T14_33_07_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-10-25T15_22_02_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-10-25T16_11_07_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-10-29T13_34_11_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-10-29T14_30_25_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-10-29T15_23_04_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-10-29T15_23_04_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-10-30T13_33_46_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-10-30T15_21_16_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-05T13_29_41_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-08T13_15_26_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-08T15_53_03_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-08T15_53_03_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-09T14_24_57_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-09T16_10_10_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-12T13_24_50_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-12T16_04_41_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-13T15_07_14_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-15T13_24_06_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-15T15_07_55_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-16T16_03_35_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-19T13_24_37_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2018-11-22T13_23_26_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-01-07T13_25_24_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-01-07T14_15_27_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-01-08T14_28_18_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-01-10T13_33_34_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-01-21T13_49_00_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-01-22T15_30_10_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-01-23T13_53_58_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-01-28T14_28_36_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-01-31T13_34_34_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-01-31T15_10_22_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-04T13_23_14_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-04T15_15_41_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-05T14_28_35_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-07T14_18_30_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-07T16_17_30_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-08T13_28_42_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-11T13_24_09_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-11T14_25_15_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-12T13_18_39_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-14T14_07_10_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-14T15_15_28_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-18T13_35_00_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-18T14_58_21_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-18T14_58_21_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-19T13_31_50_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-19T14_29_27_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-21T14_29_51_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-21T15_27_33_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-22T13_22_20_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-22T15_05_09_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-25T14_15_16_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-25T16_00_43_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-26T13_16_40_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\DL\\\\video_2019-02-26T14_04_30_arena1'],\n",
       " 'PoxN1': ['F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-05T14_25_33_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-08T14_54_53_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-09T13_32_43_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-09T15_15_47_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-09T16_10_10_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-12T14_18_04_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-12T15_11_17_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-13T13_20_38_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-13T14_12_04_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-13T15_59_40_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-15T13_24_06_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-15T14_14_38_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-16T14_16_30_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-16T15_13_19_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-19T15_13_59_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-19T16_07_25_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-22T15_13_22_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-23T13_16_41_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-23T14_06_32_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-23T15_02_48_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2018-11-26T14_23_16_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-01-07T13_25_24_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-01-10T15_20_27_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-01-21T14_42_26_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-01-24T13_41_39_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-01-25T14_42_54_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-01-25T16_37_11_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-01-28T13_29_02_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-01-28T16_23_38_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-01-29T13_47_57_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-01-31T14_23_50_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-02-11T15_21_44_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-02-12T15_09_30_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN1\\\\video_2019-02-14T13_20_25_arena1'],\n",
       " 'PoxN2': ['F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-05T13_29_41_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-05T14_25_33_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-06T15_23_12_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-08T13_15_26_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-08T14_05_24_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-09T14_24_57_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-09T16_10_10_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-13T15_59_40_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-19T13_24_37_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-19T13_24_37_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-19T16_07_25_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-20T13_17_32_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-22T13_23_26_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2018-11-26T13_22_06_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-07T15_09_49_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-08T15_26_26_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-10T16_14_19_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-10T16_14_19_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-22T13_46_31_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-22T15_30_10_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-23T13_53_58_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-23T14_43_15_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-24T14_36_54_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-25T14_42_54_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-25T15_47_08_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-28T16_23_38_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-01-29T14_34_09_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-02-11T15_21_44_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-02-12T15_09_30_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\PoxN2\\\\video_2019-02-14T14_07_10_arena4'],\n",
       " 'aristaless': ['F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-01-31T14_23_50_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-01-31T15_10_22_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-01-31T15_10_22_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-01T14_02_23_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-01T14_55_59_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-01T14_55_59_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-01T15_52_47_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-01T15_52_47_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-04T13_23_14_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-04T14_15_37_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-05T13_34_46_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-05T13_34_46_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-07T13_27_20_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-07T14_18_30_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-07T16_17_30_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-08T14_20_28_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-08T14_20_28_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-22T13_22_20_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-22T14_13_46_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-22T15_05_09_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-22T15_05_09_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-22T15_56_18_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-22T15_56_18_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-25T15_08_46_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-25T16_00_43_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-26T13_16_40_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\aristaless\\\\video_2019-02-26T15_07_41_arena2'],\n",
       " 'NorpA': ['F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-10-25T15_22_02_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-10-25T16_11_07_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-10-30T13_33_46_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-11-06T14_29_09_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-11-09T13_32_43_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-11-12T13_24_50_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-11-13T14_12_04_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-11-15T16_06_53_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-11-16T14_16_30_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-11-20T14_12_58_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-11-20T15_02_15_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-11-20T15_54_06_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2018-11-26T14_23_16_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-07T14_15_27_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-08T14_28_18_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-08T15_26_26_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-11T14_09_38_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-11T15_00_11_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-22T13_46_31_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-22T16_27_19_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-23T13_53_58_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-23T15_56_06_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-24T16_31_14_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-25T13_48_17_arena3',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-25T14_42_54_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-25T14_42_54_arena2',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-25T16_37_11_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-29T13_47_57_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-29T16_16_40_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-01-31T16_13_39_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-02-04T16_09_37_arena4',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-02-11T13_24_09_arena1',\n",
       "  'F:\\\\Miguel\\\\PhD\\\\Results\\\\Competition\\\\DL\\\\Four-Arena Setup\\\\sensory_mutants\\\\processed\\\\NorpA\\\\video_2019-02-12T15_09_30_arena3']}"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 61 ms\n"
     ]
    }
   ],
   "source": [
    "# Load all usable experiments for each condition.\n",
    "experiments = {condition: [] for condition in condition_order}\n",
    "\n",
    "for condition_path in conditions:\n",
    "    \n",
    "    condition = os.path.basename(condition_path)\n",
    "    print('\\t\\n', condition)\n",
    "    \n",
    "    for item in os.scandir(condition_path):\n",
    "        if item.is_dir() and item.name not in intruders:\n",
    "\n",
    "            annotation_video = annotations.read(item.path.split('_slice')[0] + '.csv')\n",
    "            \n",
    "            try:\n",
    "                copulation = annotation_video[0].events[0]\n",
    "\n",
    "                # Filter out videos where copulation is interrupted.\n",
    "                copulation_end = copulation.time_interval[1]\n",
    "                if copulation_end==N_FRAMES:\n",
    "                    print(item.name)\n",
    "                    continue\n",
    "\n",
    "                # Filter out videos where copulation lasts less than 8 minutes.\n",
    "                copulation_duration = copulation.duration\n",
    "                if copulation_duration <= 8 * 60 * FPS:\n",
    "                    print(item.name)\n",
    "                    continue\n",
    "            \n",
    "            except IndexError:\n",
    "                continue\n",
    "\n",
    "            experiments[condition].append(item.path.split('_slice')[0])\n",
    "\n",
    "experiments"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-09-10T01:45:37.434362Z",
     "iopub.status.busy": "2021-09-10T01:45:37.433361Z",
     "iopub.status.idle": "2021-09-10T01:45:38.656668Z",
     "shell.execute_reply": "2021-09-10T01:45:38.655669Z",
     "shell.execute_reply.started": "2021-09-10T01:45:37.434362Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Iteration: 0 \n",
      "Experiment: video_2018-10-25T13_42_23_arena4 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2018-10-25T14_33_07_arena3 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-10-25T14_33_07_arena3 \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2018-10-25T15_22_02_arena1 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-10-25T15_22_02_arena1 \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2018-10-25T16_11_07_arena3 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2018-10-29T13_34_11_arena3 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2018-10-29T14_30_25_arena4 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-10-29T14_30_25_arena4 \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2018-10-29T15_23_04_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2018-10-29T15_23_04_arena2 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-10-29T15_23_04_arena2 \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2018-10-30T13_33_46_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2018-10-30T15_21_16_arena4 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2018-11-05T13_29_41_arena2 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-11-05T13_29_41_arena2 \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2018-11-08T13_15_26_arena4 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-11-08T13_15_26_arena4 \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2018-11-08T15_53_03_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2018-11-08T15_53_03_arena3 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2018-11-09T14_24_57_arena4 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2018-11-09T16_10_10_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2018-11-12T13_24_50_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2018-11-12T16_04_41_arena4 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-11-12T16_04_41_arena4 \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2018-11-13T15_07_14_arena3 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2018-11-15T13_24_06_arena4 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-11-15T13_24_06_arena4 \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2018-11-15T15_07_55_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2018-11-16T16_03_35_arena3 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-11-16T16_03_35_arena3 \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2018-11-19T13_24_37_arena2 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-11-19T13_24_37_arena2 \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2018-11-22T13_23_26_arena4 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2018-11-22T13_23_26_arena4 \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-01-07T13_25_24_arena3 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-01-07T14_15_27_arena4 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-01-08T14_28_18_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2019-01-10T13_33_34_arena1 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2019-01-10T13_33_34_arena1 \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2019-01-21T13_49_00_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2019-01-22T15_30_10_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 30 \n",
      "Experiment: video_2019-01-23T13_53_58_arena1 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2019-01-23T13_53_58_arena1 \n",
      "\n",
      "Iteration: 31 \n",
      "Experiment: video_2019-01-28T14_28_36_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 32 \n",
      "Experiment: video_2019-01-31T13_34_34_arena3 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 33 \n",
      "Experiment: video_2019-01-31T15_10_22_arena1 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2019-01-31T15_10_22_arena1 \n",
      "\n",
      "Iteration: 34 \n",
      "Experiment: video_2019-02-04T13_23_14_arena1 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2019-02-04T13_23_14_arena1 \n",
      "\n",
      "Iteration: 35 \n",
      "Experiment: video_2019-02-04T15_15_41_arena4 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2019-02-04T15_15_41_arena4 \n",
      "\n",
      "Iteration: 36 \n",
      "Experiment: video_2019-02-05T14_28_35_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 37 \n",
      "Experiment: video_2019-02-07T14_18_30_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 38 \n",
      "Experiment: video_2019-02-07T16_17_30_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 39 \n",
      "Experiment: video_2019-02-08T13_28_42_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 40 \n",
      "Experiment: video_2019-02-11T13_24_09_arena3 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2019-02-11T13_24_09_arena3 \n",
      "\n",
      "Iteration: 41 \n",
      "Experiment: video_2019-02-11T14_25_15_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 42 \n",
      "Experiment: video_2019-02-12T13_18_39_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 43 \n",
      "Experiment: video_2019-02-14T14_07_10_arena3 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2019-02-14T14_07_10_arena3 \n",
      "\n",
      "Iteration: 44 \n",
      "Experiment: video_2019-02-14T15_15_28_arena2 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2019-02-14T15_15_28_arena2 \n",
      "\n",
      "Iteration: 45 \n",
      "Experiment: video_2019-02-18T13_35_00_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 46 \n",
      "Experiment: video_2019-02-18T14_58_21_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 47 \n",
      "Experiment: video_2019-02-18T14_58_21_arena3 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 48 \n",
      "Experiment: video_2019-02-19T13_31_50_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 49 \n",
      "Experiment: video_2019-02-19T14_29_27_arena3 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 50 \n",
      "Experiment: video_2019-02-21T14_29_51_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 51 \n",
      "Experiment: video_2019-02-21T15_27_33_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 52 \n",
      "Experiment: video_2019-02-22T13_22_20_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 53 \n",
      "Experiment: video_2019-02-22T15_05_09_arena4 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2019-02-22T15_05_09_arena4 \n",
      "\n",
      "Iteration: 54 \n",
      "Experiment: video_2019-02-25T14_15_16_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 55 \n",
      "Experiment: video_2019-02-25T16_00_43_arena1 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 56 \n",
      "Experiment: video_2019-02-26T13_16_40_arena2 \n",
      "Condition: DL \n",
      "\n",
      "Iteration: 57 \n",
      "Experiment: video_2019-02-26T14_04_30_arena1 \n",
      "Condition: DL \n",
      "\n",
      "No aggression for experiment video_2019-02-26T14_04_30_arena1 \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2018-11-05T14_25_33_arena1 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2018-11-08T14_54_53_arena3 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2018-11-09T13_32_43_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2018-11-09T15_15_47_arena4 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2018-11-09T16_10_10_arena3 \n",
      "Condition: PoxN1 \n",
      "\n",
      "No aggression for experiment video_2018-11-09T16_10_10_arena3 \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2018-11-12T14_18_04_arena3 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2018-11-12T15_11_17_arena1 \n",
      "Condition: PoxN1 \n",
      "\n",
      "No aggression for experiment video_2018-11-12T15_11_17_arena1 \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2018-11-13T13_20_38_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2018-11-13T14_12_04_arena4 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2018-11-13T15_59_40_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2018-11-15T13_24_06_arena3 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2018-11-15T14_14_38_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "No aggression for experiment video_2018-11-15T14_14_38_arena2 \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2018-11-16T14_16_30_arena1 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2018-11-16T15_13_19_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2018-11-19T15_13_59_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2018-11-19T16_07_25_arena4 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2018-11-22T15_13_22_arena3 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2018-11-23T13_16_41_arena3 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2018-11-23T14_06_32_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2018-11-23T15_02_48_arena4 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2018-11-26T14_23_16_arena3 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-01-07T13_25_24_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "No aggression for experiment video_2019-01-07T13_25_24_arena2 \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-01-10T15_20_27_arena3 \n",
      "Condition: PoxN1 \n",
      "\n",
      "No aggression for experiment video_2019-01-10T15_20_27_arena3 \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-01-21T14_42_26_arena3 \n",
      "Condition: PoxN1 \n",
      "\n",
      "No aggression for experiment video_2019-01-21T14_42_26_arena3 \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-01-24T13_41_39_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "No aggression for experiment video_2019-01-24T13_41_39_arena2 \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-01-25T14_42_54_arena4 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-01-25T16_37_11_arena1 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2019-01-28T13_29_02_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2019-01-28T16_23_38_arena1 \n",
      "Condition: PoxN1 \n",
      "\n",
      "No aggression for experiment video_2019-01-28T16_23_38_arena1 \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2019-01-29T13_47_57_arena2 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 30 \n",
      "Experiment: video_2019-01-31T14_23_50_arena4 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 31 \n",
      "Experiment: video_2019-02-11T15_21_44_arena3 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 32 \n",
      "Experiment: video_2019-02-12T15_09_30_arena4 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 33 \n",
      "Experiment: video_2019-02-14T13_20_25_arena1 \n",
      "Condition: PoxN1 \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2018-11-05T13_29_41_arena3 \n",
      "Condition: PoxN2 \n",
      "\n",
      "No aggression for experiment video_2018-11-05T13_29_41_arena3 \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2018-11-05T14_25_33_arena4 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2018-11-06T15_23_12_arena2 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2018-11-08T13_15_26_arena2 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2018-11-08T14_05_24_arena3 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2018-11-09T14_24_57_arena1 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2018-11-09T16_10_10_arena2 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2018-11-13T15_59_40_arena3 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2018-11-19T13_24_37_arena1 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2018-11-19T13_24_37_arena4 \n",
      "Condition: PoxN2 \n",
      "\n",
      "No aggression for experiment video_2018-11-19T13_24_37_arena4 \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2018-11-19T16_07_25_arena3 \n",
      "Condition: PoxN2 \n",
      "\n",
      "No aggression for experiment video_2018-11-19T16_07_25_arena3 \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2018-11-20T13_17_32_arena2 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2018-11-22T13_23_26_arena3 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2018-11-26T13_22_06_arena3 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-01-07T15_09_49_arena2 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-01-08T15_26_26_arena1 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-01-10T16_14_19_arena1 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-01-10T16_14_19_arena4 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-01-22T13_46_31_arena3 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-01-22T15_30_10_arena4 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-01-23T13_53_58_arena3 \n",
      "Condition: PoxN2 \n",
      "\n",
      "No aggression for experiment video_2019-01-23T13_53_58_arena3 \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-01-23T14_43_15_arena1 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-01-24T14_36_54_arena4 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-01-25T14_42_54_arena3 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-01-25T15_47_08_arena4 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-01-28T16_23_38_arena3 \n",
      "Condition: PoxN2 \n",
      "\n",
      "No aggression for experiment video_2019-01-28T16_23_38_arena3 \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-01-29T14_34_09_arena4 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2019-02-11T15_21_44_arena4 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2019-02-12T15_09_30_arena1 \n",
      "Condition: PoxN2 \n",
      "\n",
      "No aggression for experiment video_2019-02-12T15_09_30_arena1 \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2019-02-14T14_07_10_arena4 \n",
      "Condition: PoxN2 \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2019-01-31T14_23_50_arena1 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2019-01-31T15_10_22_arena3 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2019-01-31T15_10_22_arena4 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-01-31T15_10_22_arena4 \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2019-02-01T14_02_23_arena1 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-01T14_02_23_arena1 \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2019-02-01T14_55_59_arena2 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-01T14_55_59_arena2 \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2019-02-01T14_55_59_arena4 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2019-02-01T15_52_47_arena2 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2019-02-01T15_52_47_arena3 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-01T15_52_47_arena3 \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2019-02-04T13_23_14_arena4 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-04T13_23_14_arena4 \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2019-02-04T14_15_37_arena1 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2019-02-05T13_34_46_arena1 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2019-02-05T13_34_46_arena4 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-05T13_34_46_arena4 \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2019-02-07T13_27_20_arena4 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-07T13_27_20_arena4 \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-02-07T14_18_30_arena1 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-07T14_18_30_arena1 \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-02-07T16_17_30_arena2 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-02-08T14_20_28_arena1 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-08T14_20_28_arena1 \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-02-08T14_20_28_arena4 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-02-22T13_22_20_arena3 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-22T13_22_20_arena3 \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-02-22T14_13_46_arena3 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-22T14_13_46_arena3 \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-02-22T15_05_09_arena1 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-02-22T15_05_09_arena2 \n",
      "Condition: aristaless \n",
      "\n",
      "No aggression for experiment video_2019-02-22T15_05_09_arena2 \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-02-22T15_56_18_arena1 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-02-22T15_56_18_arena2 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-02-25T15_08_46_arena1 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-02-25T16_00_43_arena3 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-02-26T13_16_40_arena1 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-02-26T15_07_41_arena2 \n",
      "Condition: aristaless \n",
      "\n",
      "Iteration: 0 \n",
      "Experiment: video_2018-10-25T15_22_02_arena4 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2018-10-25T15_22_02_arena4 \n",
      "\n",
      "Iteration: 1 \n",
      "Experiment: video_2018-10-25T16_11_07_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 2 \n",
      "Experiment: video_2018-10-30T13_33_46_arena4 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 3 \n",
      "Experiment: video_2018-11-06T14_29_09_arena2 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2018-11-06T14_29_09_arena2 \n",
      "\n",
      "Iteration: 4 \n",
      "Experiment: video_2018-11-09T13_32_43_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2018-11-09T13_32_43_arena1 \n",
      "\n",
      "Iteration: 5 \n",
      "Experiment: video_2018-11-12T13_24_50_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2018-11-12T13_24_50_arena1 \n",
      "\n",
      "Iteration: 6 \n",
      "Experiment: video_2018-11-13T14_12_04_arena2 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2018-11-13T14_12_04_arena2 \n",
      "\n",
      "Iteration: 7 \n",
      "Experiment: video_2018-11-15T16_06_53_arena2 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2018-11-15T16_06_53_arena2 \n",
      "\n",
      "Iteration: 8 \n",
      "Experiment: video_2018-11-16T14_16_30_arena2 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 9 \n",
      "Experiment: video_2018-11-20T14_12_58_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 10 \n",
      "Experiment: video_2018-11-20T15_02_15_arena4 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2018-11-20T15_02_15_arena4 \n",
      "\n",
      "Iteration: 11 \n",
      "Experiment: video_2018-11-20T15_54_06_arena3 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 12 \n",
      "Experiment: video_2018-11-26T14_23_16_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 13 \n",
      "Experiment: video_2019-01-07T14_15_27_arena2 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-07T14_15_27_arena2 \n",
      "\n",
      "Iteration: 14 \n",
      "Experiment: video_2019-01-08T14_28_18_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-08T14_28_18_arena1 \n",
      "\n",
      "Iteration: 15 \n",
      "Experiment: video_2019-01-08T15_26_26_arena2 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-08T15_26_26_arena2 \n",
      "\n",
      "Iteration: 16 \n",
      "Experiment: video_2019-01-11T14_09_38_arena4 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 17 \n",
      "Experiment: video_2019-01-11T15_00_11_arena3 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 18 \n",
      "Experiment: video_2019-01-22T13_46_31_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-22T13_46_31_arena1 \n",
      "\n",
      "Iteration: 19 \n",
      "Experiment: video_2019-01-22T16_27_19_arena4 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-22T16_27_19_arena4 \n",
      "\n",
      "Iteration: 20 \n",
      "Experiment: video_2019-01-23T13_53_58_arena2 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-23T13_53_58_arena2 \n",
      "\n",
      "Iteration: 21 \n",
      "Experiment: video_2019-01-23T15_56_06_arena4 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-23T15_56_06_arena4 \n",
      "\n",
      "Iteration: 22 \n",
      "Experiment: video_2019-01-24T16_31_14_arena2 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-24T16_31_14_arena2 \n",
      "\n",
      "Iteration: 23 \n",
      "Experiment: video_2019-01-25T13_48_17_arena3 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-25T13_48_17_arena3 \n",
      "\n",
      "Iteration: 24 \n",
      "Experiment: video_2019-01-25T14_42_54_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 25 \n",
      "Experiment: video_2019-01-25T14_42_54_arena2 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 26 \n",
      "Experiment: video_2019-01-25T16_37_11_arena4 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-25T16_37_11_arena4 \n",
      "\n",
      "Iteration: 27 \n",
      "Experiment: video_2019-01-29T13_47_57_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-29T13_47_57_arena1 \n",
      "\n",
      "Iteration: 28 \n",
      "Experiment: video_2019-01-29T16_16_40_arena4 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 29 \n",
      "Experiment: video_2019-01-31T16_13_39_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-01-31T16_13_39_arena1 \n",
      "\n",
      "Iteration: 30 \n",
      "Experiment: video_2019-02-04T16_09_37_arena4 \n",
      "Condition: NorpA \n",
      "\n",
      "Iteration: 31 \n",
      "Experiment: video_2019-02-11T13_24_09_arena1 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-02-11T13_24_09_arena1 \n",
      "\n",
      "Iteration: 32 \n",
      "Experiment: video_2019-02-12T15_09_30_arena3 \n",
      "Condition: NorpA \n",
      "\n",
      "No aggression for experiment video_2019-02-12T15_09_30_arena3 \n",
      "\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>has_aggression</th>\n",
       "      <th>latency</th>\n",
       "      <th>latency_mins</th>\n",
       "      <th>nframes</th>\n",
       "      <th>nbouts</th>\n",
       "      <th>ratio_frames</th>\n",
       "      <th>ratio_bouts</th>\n",
       "      <th>second_female</th>\n",
       "      <th>second_fly_delay</th>\n",
       "      <th>condition</th>\n",
       "      <th>experiment</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>True</td>\n",
       "      <td>5132.0</td>\n",
       "      <td>1.425556</td>\n",
       "      <td>1364</td>\n",
       "      <td>10</td>\n",
       "      <td>0.027854</td>\n",
       "      <td>0.735144</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>DL</td>\n",
       "      <td>video_2018-10-25T13_42_23_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>DL</td>\n",
       "      <td>video_2018-10-25T14_33_07_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>DL</td>\n",
       "      <td>video_2018-10-25T15_22_02_arena1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>True</td>\n",
       "      <td>14204.0</td>\n",
       "      <td>3.945556</td>\n",
       "      <td>1685</td>\n",
       "      <td>10</td>\n",
       "      <td>0.019325</td>\n",
       "      <td>0.412868</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>DL</td>\n",
       "      <td>video_2018-10-25T16_11_07_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>True</td>\n",
       "      <td>33652.0</td>\n",
       "      <td>9.347778</td>\n",
       "      <td>935</td>\n",
       "      <td>5</td>\n",
       "      <td>0.015841</td>\n",
       "      <td>0.304956</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>DL</td>\n",
       "      <td>video_2018-10-29T13_34_11_arena3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>True</td>\n",
       "      <td>17775.0</td>\n",
       "      <td>4.937500</td>\n",
       "      <td>51</td>\n",
       "      <td>1</td>\n",
       "      <td>0.000821</td>\n",
       "      <td>0.057939</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NorpA</td>\n",
       "      <td>video_2019-01-29T16_16_40_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>178</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NorpA</td>\n",
       "      <td>video_2019-01-31T16_13_39_arena1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>179</th>\n",
       "      <td>True</td>\n",
       "      <td>50498.0</td>\n",
       "      <td>14.027222</td>\n",
       "      <td>106</td>\n",
       "      <td>2</td>\n",
       "      <td>0.001880</td>\n",
       "      <td>0.127709</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NorpA</td>\n",
       "      <td>video_2019-02-04T16_09_37_arena4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>180</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NorpA</td>\n",
       "      <td>video_2019-02-11T13_24_09_arena1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>181</th>\n",
       "      <td>False</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>NorpA</td>\n",
       "      <td>video_2019-02-12T15_09_30_arena3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>182 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "     has_aggression  latency  latency_mins  nframes  nbouts  ratio_frames  \\\n",
       "0              True   5132.0      1.425556     1364      10      0.027854   \n",
       "1             False      NaN      0.000000        0       0      0.000000   \n",
       "2             False      NaN      0.000000        0       0      0.000000   \n",
       "3              True  14204.0      3.945556     1685      10      0.019325   \n",
       "4              True  33652.0      9.347778      935       5      0.015841   \n",
       "..              ...      ...           ...      ...     ...           ...   \n",
       "177            True  17775.0      4.937500       51       1      0.000821   \n",
       "178           False      NaN      0.000000        0       0      0.000000   \n",
       "179            True  50498.0     14.027222      106       2      0.001880   \n",
       "180           False      NaN      0.000000        0       0      0.000000   \n",
       "181           False      NaN      0.000000        0       0      0.000000   \n",
       "\n",
       "     ratio_bouts  second_female  second_fly_delay condition  \\\n",
       "0       0.735144              0                 0        DL   \n",
       "1       0.000000              0                 0        DL   \n",
       "2       0.000000              0                 0        DL   \n",
       "3       0.412868              0                 0        DL   \n",
       "4       0.304956              0                 0        DL   \n",
       "..           ...            ...               ...       ...   \n",
       "177     0.057939              0                 0     NorpA   \n",
       "178     0.000000              0                 0     NorpA   \n",
       "179     0.127709              0                 0     NorpA   \n",
       "180     0.000000              0                 0     NorpA   \n",
       "181     0.000000              0                 0     NorpA   \n",
       "\n",
       "                           experiment  \n",
       "0    video_2018-10-25T13_42_23_arena4  \n",
       "1    video_2018-10-25T14_33_07_arena3  \n",
       "2    video_2018-10-25T15_22_02_arena1  \n",
       "3    video_2018-10-25T16_11_07_arena3  \n",
       "4    video_2018-10-29T13_34_11_arena3  \n",
       "..                                ...  \n",
       "177  video_2019-01-29T16_16_40_arena4  \n",
       "178  video_2019-01-31T16_13_39_arena1  \n",
       "179  video_2019-02-04T16_09_37_arena4  \n",
       "180  video_2019-02-11T13_24_09_arena1  \n",
       "181  video_2019-02-12T15_09_30_arena3  \n",
       "\n",
       "[182 rows x 11 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 1.2 s\n"
     ]
    }
   ],
   "source": [
    "aggression_df = pd.DataFrame()\n",
    "\n",
    "for condition in condition_order:\n",
    "    for h, experiment_path in enumerate(experiments[condition]):\n",
    "\n",
    "        experiment = os.path.basename(experiment_path)\n",
    "        \n",
    "        print('Iteration:', h, '\\nExperiment:', experiment, '\\nCondition:', condition, '\\n')\n",
    "        \n",
    "        # Read .csv annotation files.\n",
    "        annotation_video = annotations.read(experiment_path + '.csv')\n",
    "        copulation = annotation_video[0].events[0]\n",
    "        aggression_events = annotation_video[1].events\n",
    "        n_events = len(aggression_events)\n",
    "\n",
    "        # In case there is aggression, do the necessary calculations.\n",
    "        if n_events > 0:\n",
    "\n",
    "            latency =  aggression_events[0].time - copulation.time\n",
    "            latency_mins = latency / (60 * FPS)\n",
    "            ratio_frames = sum([aggression.duration for aggression in aggression_events]) / copulation.duration\n",
    "            ratio_bouts = n_events / (copulation.duration / (60 * FPS))\n",
    "\n",
    "            aggression_data = pd.DataFrame({'has_aggression': True,\n",
    "                                            'latency': latency,\n",
    "                                            'latency_mins': latency_mins,\n",
    "                                            'nframes': sum([aggression.duration for aggression in aggression_events]),\n",
    "                                            'nbouts': n_events,\n",
    "                                            'ratio_frames': ratio_frames,\n",
    "                                            'ratio_bouts': ratio_bouts,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # If not, preset our dictionary with default values.\n",
    "        else:\n",
    "            print('No aggression for experiment', experiment, '\\n')\n",
    "            \n",
    "            aggression_data = pd.DataFrame({'has_aggression': False,\n",
    "                                            'latency': np.nan,\n",
    "                                            'latency_mins': 0,\n",
    "                                            'nframes': 0,\n",
    "                                            'nbouts': 0,\n",
    "                                            'ratio_frames': 0, \n",
    "                                            'ratio_bouts': 0,\n",
    "                                            'condition': condition,\n",
    "                                            'experiment': experiment},\n",
    "                                            index=[h],\n",
    "                                           )\n",
    "\n",
    "        # Concatenate all data together.\n",
    "        aggression_df = pd.concat([aggression_df, aggression_data], ignore_index=True)\n",
    "\n",
    "aggression_df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Outliers Detection"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-09-10T01:45:38.657667Z",
     "iopub.status.busy": "2021-09-10T01:45:38.657667Z",
     "iopub.status.idle": "2021-09-10T01:45:38.704643Z",
     "shell.execute_reply": "2021-09-10T01:45:38.703643Z",
     "shell.execute_reply.started": "2021-09-10T01:45:38.657667Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "defaultdict(list,\n",
       "            {'DL': ['video_2018-10-29T15_23_04_arena1',\n",
       "              'video_2018-10-30T15_21_16_arena4',\n",
       "              'video_2019-02-21T15_27_33_arena2'],\n",
       "             'aristaless': ['video_2019-02-22T15_56_18_arena1']})"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "time: 31 ms\n"
     ]
    }
   ],
   "source": [
    "outlier_experiments = defaultdict(list)\n",
    "\n",
    "for condition in condition_order:\n",
    "\n",
    "    # Fetch the relevant column to filter by, which for us will be the \"ratio_frames\" columns.\n",
    "    dataset = aggression_df.query('condition==\"' + condition + '\"')['ratio_frames']\n",
    "\n",
    "    # Get the index for each outlier.\n",
    "    outlier_positions = helpers.check_outliers(dataset)\n",
    "\n",
    "    for outlier in outlier_positions:\n",
    "    \n",
    "        # For each outlier index found previously, get the corresponding experiment name.\n",
    "        experiment = aggression_df.loc[outlier, ['experiment']].values[0]\n",
    "\n",
    "        # Store the outlier experiment into the dictionary, associate to its respective condition.\n",
    "        outlier_experiments[condition].append(experiment)\n",
    "    \n",
    "outlier_experiments"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Writing to File"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-09-10T01:45:38.706642Z",
     "iopub.status.busy": "2021-09-10T01:45:38.705642Z",
     "iopub.status.idle": "2021-09-10T01:45:38.736624Z",
     "shell.execute_reply": "2021-09-10T01:45:38.735623Z",
     "shell.execute_reply.started": "2021-09-10T01:45:38.706642Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\t DL\n",
      "Outliers already detected!\n",
      "\t aristaless\n",
      "Outliers already detected!\n",
      "\n",
      "Done!\n",
      "\n",
      "time: 13 ms\n"
     ]
    }
   ],
   "source": [
    "for condition in outlier_experiments.keys():\n",
    "    \n",
    "    print('\\t', condition)\n",
    "\n",
    "    # Path to currently existing \"quality_control\" file.\n",
    "    path_to_quality_file = os.path.join(EXPERIMENTS_PATH, condition)\n",
    "\n",
    "    for item in os.scandir(path_to_quality_file):\n",
    "\n",
    "        if item.name == 'quality_control.csv':\n",
    "            \n",
    "            # If there are already \"outlier\" comments in the csv, then we've already detected outliers and we can skip this part.\n",
    "            quality_df = pd.read_csv(item.path, usecols=[0,1,2])\n",
    "            if 'outlier' in quality_df['comment'].values:\n",
    "                print('Outliers already detected!')\n",
    "                break\n",
    "\n",
    "            # Get outliers for the current condition.\n",
    "            current_outliers = outlier_experiments[condition]\n",
    "            print(current_outliers, '\\n')\n",
    "\n",
    "            # Create a new, blank temporary file.\n",
    "            temp_file = os.path.join(path_to_quality_file, 'temp.csv')\n",
    "\n",
    "            with open(item, mode='r') as input_file, open(temp_file, mode='w') as output_file:\n",
    "\n",
    "                # Read existing \"quality_control\" file line by line.\n",
    "                for line in input_file.readlines():\n",
    "\n",
    "                    is_edited = False\n",
    "                    for outlier in current_outliers:\n",
    "\n",
    "                        if outlier in line:\n",
    "\n",
    "                            # Edit the existing line where an outlier was found.\n",
    "                            new_line = line.replace('TRUE', 'FALSE,outlier')\n",
    "\n",
    "                            # Write the edited line to the temporary file.\n",
    "                            output_file.write(new_line)\n",
    "\n",
    "                            is_edited = True\n",
    "\n",
    "                    if is_edited == False:\n",
    "\n",
    "                        # Write any unedited lines as they are to the temporary file.\n",
    "                        output_file.write(line)\n",
    "\n",
    "            # Delete the old, pre-existing \"quality_control\"\n",
    "            os.remove(item)\n",
    "            \n",
    "            # Rename the temporary file to \"quality_control\".\n",
    "            os.rename(temp_file, os.path.join(path_to_quality_file, 'quality_control.csv'))\n",
    "            \n",
    "print('\\nDone!\\n')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
